package bma.common.thrift;

import java.io.InputStream;

import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.annotate.JsonUnwrapped;

import junit.framework.TestCase;
import bma.common.json.JsonEditorTest;
import bma.common.json.JsonUtil;
import bma.common.json.xdom.XdomJson;
import bma.common.langutil.bean.BeanClass;
import bma.common.langutil.bean.BeanSystem;
import bma.common.langutil.core.ResourceUtil;
import bma.common.langutil.io.IOUtil;
import bma.common.langutil.xdom.Xdom;
import bma.common.thrift.bean.BeanClassBuilderTBase;
import bma.common.thrift.sample.Hello;
import bma.common.thrift.xdom.impl.DynamicThriftManagerSimple;

public class TProcessXdomTC extends TestCase {

	final org.slf4j.Logger log = org.slf4j.LoggerFactory
			.getLogger(TProcessXdomTC.class);
	
	protected String read(String fileName) throws Exception {
		return IOUtil.readStreamToString((InputStream) ResourceUtil
				.getResourceFromClass(TProcessXdomTC.class, fileName)
				.getContent(), "UTF-8");
	}

	public void testManagerSimple() throws Exception {
		
		String json = read("hello.json");
		JsonNode node = JsonUtil.parse(json);

		Xdom desc = new XdomJson().bind(node);
		
		DynamicThriftManagerSimple manager = new DynamicThriftManagerSimple();
		manager.init(desc);
	}
}
